7.3 Plotting points and line segments

The value of a two-element vector, single-angle radial or complex number determines a point in two-dimensional space; the value of a three-element vector or a two-angle radial determines a location in 3-dimensional space. For the purposes of plotting, a tuple of scalars is treated like a vector.

When plotted, a single point defines a position vector; a pair of points (a sequence of two points) defines a line segment; and a sequence of n points defines a sequence of n-1 line segments. A sequence is represented by a tuple-of-points expression. The sequence can be a tuple value or an iterable tuple generator.

Position vectors and point sequences are drawn differently by the plotter. A position vector is drawn as a line from the origin to the point represented by the position. Point sequences are plotted as straight lines between the points.

Here are some examples of values that can be displayed by the plotter.

((0, 0)ʋ, (1, 1)ʋ, (2, 4)ʋ, (3, 9)ʋ)

(1)


{(0, 0)ʋ, (1, 1)ʋ, (2, 4)ʋ, (3, 9)ʋ}

(2)


((x, x^3-x)ʋ|x∈-2, 2, 0.1)

(3)


((x, f(x))ʋ|x∈-2, 2, 0.1)

(4)


in the presence of f(x)→x^3-x

(5)


(f(x)→x^3-x, ((x, f(x))ʋ|x∈-2, 2, 0.1))

(6)


(f(x)→x^3-x, {(x, f(x))ʋ|x∈-2, 2, 0.1})

(7)


Expressions (2) and (7) plot position vectors. Having no order, elements of sets cannot be considered as sequential. They must be treated as single points and hence as position vectors.

Expressions (3), (4) and (6) display the same plot. The expression in (4) is incomplete. Expression (5) has to be present in the plotter to complete the binding for (4). In contrast, (6) is self defining.

Expression (5) has the role of an auxiliary plot function. It must be added to the plotter to fulfill a binding requirement, but is not to be plotted itself. Unfortunately, having exactly one parameter the function fulfills the requirements of a plottable function. To prevent it from being plotted, expression (5) must be protected before handing it off to the plotter. The plotter makes protected definitions available to the binder. Auxiliary functions with no parameters or more than one parameter are not plottable so the extra step of protecting them is not necessary.

Expression (6) is a serial tuple (see §9.4). It collects the auxiliary function and line-segment generator into one expression.

Plotting point sequences closely approximates mathematical notion of parametric equations. Refer to §7.5 for more information on plotting parametric expressions and see §7.6 for more information on plotting with tuple generators.